#include <kernel.h>
#include <pa4.h>


/*
 * Part A 2/4. buf_close()
 * buf_close() deallocates all the resources that buffer manager has used.
 */
void buf_close(void) {

dsk_buffer_p temp,tmp;

temp=buf_head;
if(temp)
{
	while(temp)
	{
		tmp=temp;
		temp=temp->next;
		if(tmp->data)
		freemem(temp->data,128);
		freemem(tmp,sizeof(struct buf));
	}
}
else
{
 	printf("\nNo Elements in buffer, Resources free.");
}
}

